{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f7f7e58d-2b30-444e-be87-d0108ed1ec68",
   "metadata": {},
   "outputs": [
    {
     "ename": "TclError",
     "evalue": "no display name and no $DISPLAY environment variable",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mTclError\u001b[0m                                  Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[1], line 17\u001b[0m\n\u001b[1;32m     15\u001b[0m         turtle\u001b[38;5;241m.\u001b[39mfd(\u001b[38;5;241m40\u001b[39m)\n\u001b[1;32m     16\u001b[0m     drawCircle()\n\u001b[0;32m---> 17\u001b[0m \u001b[43mdrawRowCircle\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m5\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m     18\u001b[0m turtle\u001b[38;5;241m.\u001b[39mhideturtle()\n\u001b[1;32m     19\u001b[0m turtle\u001b[38;5;241m.\u001b[39mdone()\n",
      "Cell \u001b[0;32mIn[1], line 10\u001b[0m, in \u001b[0;36mdrawRowCircle\u001b[0;34m(n)\u001b[0m\n\u001b[1;32m      8\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m j  \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(n,\u001b[38;5;241m1\u001b[39m,\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m1\u001b[39m):\n\u001b[1;32m      9\u001b[0m     \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(j):\n\u001b[0;32m---> 10\u001b[0m         \u001b[43mdrawCircle\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m        \n\u001b[1;32m     11\u001b[0m     turtle\u001b[38;5;241m.\u001b[39mfd(\u001b[38;5;241m-\u001b[39mj\u001b[38;5;241m*\u001b[39m\u001b[38;5;241m40\u001b[39m\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m20\u001b[39m)\n\u001b[1;32m     12\u001b[0m     turtle\u001b[38;5;241m.\u001b[39mright(\u001b[38;5;241m90\u001b[39m)\n",
      "Cell \u001b[0;32mIn[1], line 3\u001b[0m, in \u001b[0;36mdrawCircle\u001b[0;34m()\u001b[0m\n\u001b[1;32m      2\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdrawCircle\u001b[39m():\n\u001b[0;32m----> 3\u001b[0m     \u001b[43mturtle\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mpendown\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m \n\u001b[1;32m      4\u001b[0m     turtle\u001b[38;5;241m.\u001b[39mcircle(\u001b[38;5;241m20\u001b[39m)\n\u001b[1;32m      5\u001b[0m     turtle\u001b[38;5;241m.\u001b[39mpenup() \n",
      "File \u001b[0;32m<string>:6\u001b[0m, in \u001b[0;36mpendown\u001b[0;34m()\u001b[0m\n",
      "File \u001b[0;32m/opt/conda/lib/python3.11/turtle.py:3830\u001b[0m, in \u001b[0;36mTurtle.__init__\u001b[0;34m(self, shape, undobuffersize, visible)\u001b[0m\n\u001b[1;32m   3825\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__init__\u001b[39m(\u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m   3826\u001b[0m              shape\u001b[38;5;241m=\u001b[39m_CFG[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mshape\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[1;32m   3827\u001b[0m              undobuffersize\u001b[38;5;241m=\u001b[39m_CFG[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mundobuffersize\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[1;32m   3828\u001b[0m              visible\u001b[38;5;241m=\u001b[39m_CFG[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mvisible\u001b[39m\u001b[38;5;124m\"\u001b[39m]):\n\u001b[1;32m   3829\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m Turtle\u001b[38;5;241m.\u001b[39m_screen \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m-> 3830\u001b[0m         Turtle\u001b[38;5;241m.\u001b[39m_screen \u001b[38;5;241m=\u001b[39m \u001b[43mScreen\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m   3831\u001b[0m     RawTurtle\u001b[38;5;241m.\u001b[39m\u001b[38;5;21m__init__\u001b[39m(\u001b[38;5;28mself\u001b[39m, Turtle\u001b[38;5;241m.\u001b[39m_screen,\n\u001b[1;32m   3832\u001b[0m                        shape\u001b[38;5;241m=\u001b[39mshape,\n\u001b[1;32m   3833\u001b[0m                        undobuffersize\u001b[38;5;241m=\u001b[39mundobuffersize,\n\u001b[1;32m   3834\u001b[0m                        visible\u001b[38;5;241m=\u001b[39mvisible)\n",
      "File \u001b[0;32m/opt/conda/lib/python3.11/turtle.py:3680\u001b[0m, in \u001b[0;36mScreen\u001b[0;34m()\u001b[0m\n\u001b[1;32m   3676\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Return the singleton screen object.\u001b[39;00m\n\u001b[1;32m   3677\u001b[0m \u001b[38;5;124;03mIf none exists at the moment, create a new one and return it,\u001b[39;00m\n\u001b[1;32m   3678\u001b[0m \u001b[38;5;124;03melse return the existing one.\"\"\"\u001b[39;00m\n\u001b[1;32m   3679\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m Turtle\u001b[38;5;241m.\u001b[39m_screen \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m-> 3680\u001b[0m     Turtle\u001b[38;5;241m.\u001b[39m_screen \u001b[38;5;241m=\u001b[39m \u001b[43m_Screen\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m   3681\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m Turtle\u001b[38;5;241m.\u001b[39m_screen\n",
      "File \u001b[0;32m/opt/conda/lib/python3.11/turtle.py:3696\u001b[0m, in \u001b[0;36m_Screen.__init__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m   3689\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__init__\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[1;32m   3690\u001b[0m     \u001b[38;5;66;03m# XXX there is no need for this code to be conditional,\u001b[39;00m\n\u001b[1;32m   3691\u001b[0m     \u001b[38;5;66;03m# as there will be only a single _Screen instance, anyway\u001b[39;00m\n\u001b[1;32m   3692\u001b[0m     \u001b[38;5;66;03m# XXX actually, the turtle demo is injecting root window,\u001b[39;00m\n\u001b[1;32m   3693\u001b[0m     \u001b[38;5;66;03m# so perhaps the conditional creation of a root should be\u001b[39;00m\n\u001b[1;32m   3694\u001b[0m     \u001b[38;5;66;03m# preserved (perhaps by passing it as an optional parameter)\u001b[39;00m\n\u001b[1;32m   3695\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m _Screen\u001b[38;5;241m.\u001b[39m_root \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m-> 3696\u001b[0m         _Screen\u001b[38;5;241m.\u001b[39m_root \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_root \u001b[38;5;241m=\u001b[39m \u001b[43m_Root\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m   3697\u001b[0m         \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_root\u001b[38;5;241m.\u001b[39mtitle(_Screen\u001b[38;5;241m.\u001b[39m_title)\n\u001b[1;32m   3698\u001b[0m         \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_root\u001b[38;5;241m.\u001b[39mondestroy(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_destroy)\n",
      "File \u001b[0;32m/opt/conda/lib/python3.11/turtle.py:436\u001b[0m, in \u001b[0;36m_Root.__init__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m    435\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__init__\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[0;32m--> 436\u001b[0m     \u001b[43mTK\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mTk\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__init__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n",
      "File \u001b[0;32m/opt/conda/lib/python3.11/tkinter/__init__.py:2345\u001b[0m, in \u001b[0;36mTk.__init__\u001b[0;34m(self, screenName, baseName, className, useTk, sync, use)\u001b[0m\n\u001b[1;32m   2343\u001b[0m         baseName \u001b[38;5;241m=\u001b[39m baseName \u001b[38;5;241m+\u001b[39m ext\n\u001b[1;32m   2344\u001b[0m interactive \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[0;32m-> 2345\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtk \u001b[38;5;241m=\u001b[39m \u001b[43m_tkinter\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcreate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mscreenName\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbaseName\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mclassName\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43minteractive\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mwantobjects\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43museTk\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msync\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43muse\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m   2346\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m useTk:\n\u001b[1;32m   2347\u001b[0m     \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_loadtk()\n",
      "\u001b[0;31mTclError\u001b[0m: no display name and no $DISPLAY environment variable"
     ]
    }
   ],
   "source": [
    "import turtle\n",
    "def drawCircle():\n",
    "    turtle. pendown() \n",
    "    turtle.circle(20)\n",
    "    turtle.penup() \n",
    "    turtle.fd(40)\n",
    "def drawRowCircle(n):\n",
    "    for j  in range(n,1,-1):\n",
    "        for i in range(j):\n",
    "            drawCircle()        \n",
    "        turtle.fd(-j*40-20)\n",
    "        turtle.right(90)\n",
    "        turtle.fd(40)\n",
    "        turtle.left(90) \n",
    "        turtle.fd(40)\n",
    "    drawCircle()\n",
    "drawRowCircle(5)\n",
    "turtle.hideturtle()\n",
    "turtle.done()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bb2cf498-fd74-4345-a176-4209ec9e9549",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
